GtkStyleContext: Handle directionality when picking next provider.
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 30 Nov 2010 01:13:10 +0000 (02:13 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:39:50 +0000 (15:39 +0100)
gtk/gtkstylecontext.c

index 1ec47e2216745948735cc40d423a80a4da9771af..35d7eee06b68dc04dda95a52d7b323ab9bd18219 100644 (file)
@@ -977,8 +977,9 @@ gtk_style_context_impl_get_property (GObject    *object,
 }
 
 static GList *
-find_next_candidate (GList *local,
-                     GList *global)
+find_next_candidate (GList    *local,
+                     GList    *global,
+                     gboolean  ascending)
 {
   if (local && global)
     {
@@ -988,9 +989,9 @@ find_next_candidate (GList *local,
       global_data = global->data;
 
       if (local_data->priority < global_data->priority)
-        return local;
+        return (ascending) ? local : global;
       else
-        return global;
+        return (ascending) ? global : local;
     }
   else if (local)
     return local;
@@ -1014,7 +1015,7 @@ build_properties (GtkStyleContext *context,
   if (priv->screen)
     global_list = g_object_get_qdata (G_OBJECT (priv->screen), provider_list_quark);
 
-  while ((elem = find_next_candidate (list, global_list)) != NULL)
+  while ((elem = find_next_candidate (list, global_list, TRUE)) != NULL)
     {
       GtkStyleProviderData *data;
       GtkStyleProperties *provider_style;
@@ -1053,7 +1054,7 @@ build_icon_factories (GtkStyleContext *context,
       global_list = g_list_last (global_list);
     }
 
-  while ((elem = find_next_candidate (list, global_list)) != NULL)
+  while ((elem = find_next_candidate (list, global_list, FALSE)) != NULL)
     {
       GtkIconFactory *factory;
       GtkStyleProviderData *data;
@@ -2280,7 +2281,7 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
       list = priv->providers_last;
       global = global_list;
 
-      while ((elem = find_next_candidate (list, global)) != NULL)
+      while ((elem = find_next_candidate (list, global, FALSE)) != NULL)
         {
           GtkStyleProviderData *provider_data;